package com.ryandj.handler;

import com.ryandj.exMessage.OOTDException;
import com.ryandj.result.WebResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * Created by wdj on 2024/6/7
 */


/**
 * 全局异常处理
 */
@Slf4j
@RestControllerAdvice
public class GlobalExceptionHandler {


    @ExceptionHandler(OOTDException.class)
    public WebResult<Object> OOTDExceptionHandler(OOTDException e){
        log.error("----->"+e.getMessage(),e);
        return WebResult.failure(e.getCode(),e.getMessage());
    }
}
